
log using "II Replication Log File.txt", text append

***** Replication do file for "Military in the Cabinet and Defense Spending of Civilian Governments"

************************* Authors:
***Nazmus Sakib, University of Kentucky. email: nirjhor.sakib@gmail.com
***Md Muhibbur Rahman, University of Texas, Austin. email: r.muhib@utexas.edu

*** December 2022


***********************************************************************************************************************************


*** Loading dataset

use IIrep_data, clear
xtset ccode year


****************************************** Figures and Tables in the Main Texts ************************************************


*** Figure 1 : Defense spending (logged) by military presence in the cabinet

twoway histogram lnmilexp,  || kdensity lnmilexp ||, by(defmin)



*** Figure 2: Military presence and its distribution by regime type

graph hbar, over(defmin)


graph hbar, ///
over(democracy, label(labsize(small)) relabel(`r(relabel)')) ///
over(defmin,label(labsize(small))) ///
ytitle("Military in Cabinet", size(small)) ///
title("Distribution by Regime Type" ///
, span size(medium)) ///
blabel(bar) ///
intensity(25)


*** Figure 3: Coefficients for military presence with 95 percent CIs

xi: xtreg lnmilexp defmin rivalry mid defense lngdppc democracy civilwar milper i.year, fe vce(cluster ccode)
est sto mI

xtregar lnmilexp L.lnmilexp defmin rivalry mid defense lngdppc democracy civilwar milper, fe
est sto mII

xtregar lnmilexp L.lnmilexp defmin L.defmin rivalry mid defense lngdppc democracy civilwar milper, fe
est sto mIII


esttab mI mII mIII using fig3_coef.tex, se wide nogaps drop(_Iyear_*)varwidth(40) label
esttab mI mII mIII using fig3_ci.tex, ci wide nogaps drop(_Iyear_*)varwidth(40) label

* Note: Based on the coefficients and CIs taken from the above tables, Figure 2 is created mannually using R. 


*** Table 1: Military presence in the cabinet and defense spending

xi: xtreg lnmilexp defmin rivalry mid defense lngdppc democracy civilwar milper i.year, fe vce(cluster ccode)
est sto m01

xtregar lnmilexp L.lnmilexp defmin rivalry mid defense lngdppc democracy civilwar milper, fe
est sto m02

xtregar lnmilexp L.lnmilexp defmin L.defmin rivalry mid defense lngdppc democracy civilwar milper, fe
est sto m03


esttab m01 m02 m03 using tab1_coefse.tex, se wide nogaps drop(_Iyear_*)varwidth(40) label


*** Figure 4: Substantive effects

xtreg lnmilexp i.defmin rivalry i.mid defense lngdppc democracy civilwar milper i.year, fe r cluster(ccode)
margins defmin, atmeans expression(exp(predict(xb)))
marginsplot, recastci(rarea)

xtreg lnmilexp i.defmin rivalry i.mid defense lngdppc democracy civilwar milper i.year, fe r cluster(ccode)
margins defmin, atmeans at(democracy==1) expression(exp(predict(xb)))
marginsplot, recastci(rarea)

xtreg lnmilexp i.defmin rivalry i.mid defense lngdppc democracy civilwar milper i.year, fe r cluster(ccode)
margins defmin, atmeans at(mid==0) expression(exp(predict(xb)))
marginsplot, recastci(rarea)

xtreg lnmilexp i.defmin rivalry i.mid defense lngdppc democracy civilwar milper i.year, fe r cluster(ccode)
margins defmin, atmeans at(civilwar==0) expression(exp(predict(xb)))
marginsplot, recastci(rarea)

xtreg lnmilexp i.defmin rivalry i.mid defense lngdppc democracy civilwar milper i.year, fe r cluster(ccode)
margins defmin, atmeans at(lngdppc==(5(1)11)) expression(exp(predict(xb))) noci
marginsplot, noci

xtreg lnmilexp i.defmin rivalry i.mid defense lngdppc democracy civilwar milper i.year, fe r cluster(ccode)
margins defmin, atmeans at(milper==(0(300)4100)) expression(exp(predict(xb))) noci
marginsplot, noci

* Substantive effects calculation

gen subeff1 = exp(0.179)
gen subeff2 = exp(0.0991)
gen subeff3 = exp(0.102)

gen subeff_per1 =(1.196-1)*100
gen subeff_per2 =(1.104-1)*100
gen subeff_per3 =(1.107-1)*100

gen lteff1 = exp(0.155)
gen ltef_per1 = (1.68-1)*100



*** Table 2: Robustness checks: Alternative measures of military presence

xi: xtreg lnmilexp mil_mofa rivalry mid defense lngdppc democracy civilwar milper i.year, fe vce(cluster ccode)
est sto am01

xi: xtreg lnmilexp mil_int rivalry mid defense lngdppc democracy civilwar milper i.year, fe vce(cluster ccode)
est sto am02

xi: xtreg lnmilexp milingov_dum rivalry mid defense lngdppc democracy civilwar milper i.year, fe vce(cluster ccode)
est sto am03

xi: xtreg lnmilexp milingov rivalry mid defense lngdppc democracy civilwar milper i.year, fe vce(cluster ccode)
est sto am04

xi: xtreg lnmilexp milsecshare milnonsecshare rivalry mid defense lngdppc democracy civilwar milper i.year, fe vce(cluster ccode)
est sto am05

esttab am01 am02 am03 am04 am05 using tab2_coefse.tex, se nogaps drop(_Iyear_*)varwidth(40) label



****************************************** Figures and Tables in the Appendices ************************************************


*** Table 3: Summary statistics

estpost sum lnmilexp defmin mil_mofa mil_int milingov_dum milingov milsecshare milnonsecshare land rivalry mid defense lnpop lngdppc democracy civilwar milper conscrip
esttab using dstab_1.tex, cell ((count mean sd min max)) b(3) varwidth(30)


*** Figure 5: Distribution of the dependent variable

hist milexp
hist lnmilexp


*** Table 4: Hausman test

xi: xtreg lnmilexp defmin rivalry mid defense lngdppc democracy civilwar milper i.year, fe 
estimate store FE

xi: xtreg lnmilexp defmin rivalry mid defense lngdppc democracy civilwar milper i.year, re 
estimate store RE

hausman FE RE, sigmamore 


* Joint significance test of i.year

xtreg lnmilexp defmin rivalry mid defense lngdppc democracy civilwar milper i.year, fe 
testparm i.year


*** Table 5: Alternative measure of defense spending 

* Alternative measure: military spending as percentage of GDP

xi: xtreg lnmilexpGDP defmin rivalry mid defense lngdppc democracy civilwar milper i.year, fe vce(cluster ccode)
est sto rm01

xtregar lnmilexpGDP L.lnmilexpGDP defmin rivalry mid defense lngdppc democracy civilwar milper, fe
est sto rm02

xtregar lnmilexpGDP L.lnmilexpGDP defmin L.defmin rivalry mid defense lngdppc democracy civilwar milper, fe
est sto rm03

esttab rm01 rm02 rm03 using tab5_coefse.tex, se nogaps drop(_Iyear_*)varwidth(40) label



*** Table 6: Logged military size as the control variable

* Logged measure of military size

xi: xtreg lnmilexp defmin rivalry mid defense lngdppc democracy civilwar lnmilsize i.year, fe 
est sto rm04

xtregar lnmilexp L.lnmilexp defmin rivalry mid defense lngdppc democracy civilwar lnmilsize, fe
est sto rm05

xtregar lnmilexp L.lnmilexp defmin L.defmin rivalry mid defense lngdppc democracy civilwar lnmilsize, fe
est sto rm06

esttab rm04 rm05 rm06 using tab6_coefse.tex, se nogaps drop(_Iyear_*)varwidth(40) label


*** Table 7: Alternative measures of international threat environment 

* Controlling more intense international conflict and total number of conflicts in the international system

xi: xtreg lnmilexp defmin rivalry mid_fat defense lngdppc democracy civilwar milper i.year, fe 
est sto rm07

xi: xtreg lnmilexp defmin rivalry mid_fat conflict_total defense lngdppc democracy civilwar milper i.year, fe 
est sto rm08


esttab rm07 rm08 using tab7_coefse.tex, se nogaps drop(_Iyear_*)varwidth(40) label


*** Table 8: Robustness checks: FE models

*** FE models with additional covariates 

xi: xtreg lnmilexp defmin rivalry mid defense lngdppc democracy civilwar milper land i.year, fe vce(cluster ccode)
est sto rm09

xi: xtreg lnmilexp defmin rivalry mid defense lngdppc democracy civilwar milper land lnpop i.year, fe vce(cluster ccode)
est sto rm10

xi: xtreg lnmilexp defmin rivalry mid defense lngdppc democracy civilwar milper land lnpop conscrip i.year, fe vce(cluster ccode)
est sto rm11

esttab rm09 rm10 rm11 using tab8_coefse.tex, se wide nogaps drop(_Iyear_*)varwidth(40) label


*** Table 9: Robustness checks: ADL models

*** ADL models with additional covariates

xtregar lnmilexp L.lnmilexp L2.lnmilexp defmin L.defmin rivalry mid defense lngdppc democracy civilwar milper, fe
est sto rm12

xtregar lnmilexp L.lnmilexp L2.lnmilexp L3.lnmilexp defmin L.defmin rivalry mid defense lngdppc democracy civilwar milper, fe
est sto rm13

esttab rm12 rm13 using tab9_coefse.tex, se wide nogaps varwidth(40) label



*** Table 10: Robustness checks: Time since the last coup and region dummies

* Controlling past coups and region-specific dummies 
 
use IIrep_data, clear
xtset ccode year

gen region = 0
replace region = 1 if region_NoAmer == 1
replace region = 2 if region_Latin == 1
replace region = 3 if region_EurCentAsia == 1
replace region = 4 if region_EAsiaPac == 1
replace region = 5 if region_SoAsia  == 1
replace region = 6 if region_MENA  == 1
replace region = 7 if region_SSA  == 1


xi: xtreg lnmilexp defmin rivalry mid defense lngdppc democracy civilwar milper any_coup i.year, fe vce(cluster ccode)
est sto rm14

xi: xtreg lnmilexp defmin rivalry mid defense lngdppc democracy civilwar milper succ_coup i.year, fe vce(cluster ccode)
est sto rm15

xi: xtreg lnmilexp defmin rivalry mid defense lngdppc democracy civilwar milper succ_coup i.region i.year, vce(cluster ccode)
est sto rm16

esttab rm14 rm15 rm16 using tab10_coefse.tex, se nogaps drop(_Iyear_*)varwidth(40) label


log close








